<?php
class retrieve_information_admin extends retrieve_base{

	private $module_display_options 	= array();
	
	/*************************************************************************************************************************
	* function produces abstract structure of modules db structure
	*
    * used to generate the table structure required abstract function that passes an abstract
	* representation of the desired table structure to the proper database module which will
	* interpet the abstract and convert it into a valid SQL Create table structure.
	*
	* @return Array list of abstract table definitions for this module
	*************************************************************************************************************************/
	function create_table(){
		$tables = array();
		/*************************************************************************************************************************
		* Table structure for table 'information_list'
		*************************************************************************************************************************/

		$fields = array(
			array("info_identifier"			,"unsigned integer"			,"NOT NULL"	,"default '0'" ,"key"),
			array("info_client"				,"unsigned integer"			,"NOT NULL"	,"default '0'","key"),
			array("info_category"			,"unsigned integer"			,"NOT NULL"	,"default '0'","key"),
			array("info_label"				,"varchar(255)"				,"NOT NULL"	,"default ''"),
			array("info_creation_date"		,"datetime"					,"NOT NULL"	,"default '0000-00-00 00:00:00'"),
			array("info_status"				,"unsigned integer"			,"NOT NULL"	,"default '0'"),
			array("info_workflow_status"	,"unsigned integer"			,"NOT NULL"	,"default '0'"),
			array("info_display"			,"varchar(25)"				,"NOT NULL"	,"default 'display_2_lvl'"),
			array("info_columns"			,"unsigned integer"			,"NOT NULL"	,"default '0'"),
			array("info_summary_layout"		,"unsigned small integer"	,"NOT NULL"	,"default '0'"),
			array("info_atoz_layout"		,"unsigned small integer"	,"NOT NULL"	,"default '0'"),
			array("info_update_access"		,"unsigned integer"			,"NOT NULL"	,"default '0'"),
			array("info_vcontrol"			,"unsigned integer"			,"NOT NULL"	,"default '0'"),
			array("info_menu_location"		,"unsigned integer"			,"NOT NULL"	,"default '0'","key"),
			array("info_searchresults"		,"unsigned small integer"	,"NOT NULL"	,"default '10'"),
			array("info_shop_enabled"		,"unsigned small integer"	,"NOT NULL"	,"default '0'"),
			array("info_in_menu"			,"unsigned small integer"	,"NOT NULL"	,"default '0'"),
			array("info_cat_label"			,"varchar(255)"				,"NOT NULL"	,"default ''"),
			array("info_owner"				,"varchar(255)"				,"NOT NULL"	,"default ''"),
			array("info_add_label"			,"varchar(255)"				,"NOT NULL"	,"default ''"),
			array("info_no_stock_label"		,"varchar(255)"				,"NOT NULL"	,"default ''"),
			array("info_summary_only"		,"unsigned small integer"	,"NOT NULL"	,"default '0'"),
			array("info_no_stock_display"	,"unsigned small integer"	,"NOT NULL"	,"default '1'")
		);
		$primary ="info_identifier";
		$tables[count($tables)] = array("information_list", $fields, $primary);
		
		/*************************************************************************************************************************
		* Table structure for table 'information_data'
		*************************************************************************************************************************/
		$fields = array(
			array("id_identifier"		,"unsigned integer"			,"NOT NULL"	,"default '0'","key"),
	  		array("id_client"			,"unsigned integer"			,"NOT NULL"	,"default '0'"),
	  		array("id_field"			,"varchar(255)"				,"NOT NULL"	,"default ''"),
	  		array("id_value"			,"varchar(255)"				,"NOT NULL"	,"default ''"),
	  		array("id_list"				,"unsigned integer"			,"NOT NULL"	,"default '0'"),
	  		array("id_entry"			,"unsigned integer"			,"NOT NULL"	,"default '0'")
		);
		$primary ="id_identifier";

		$tables[count($tables)] = array("information_data", $fields, $primary);

		$fields = array(
	  		array("ie_identifier"		,"unsigned integer"			,"NOT NULL"	,"default '0'","key"),
	  		array("ie_client"			,"unsigned integer"			,"NOT NULL"	,"default '0'","key"),
	  		array("ie_list"				,"unsigned integer"			,"NOT NULL"	,"default '0'","key"),
	  		array("ie_status"			,"unsigned small integer"	,"NOT NULL"	,"default '0'","key"),
	  		array("ie_uri"				,"varchar(255)"				,"NOT NULL"	,"default ''"),
	  		array("ie_date_created"		,"datetime"					,"NOT NULL"	,"default '0000-00-00 00:00:00'"),
			array("ie_user"				,"unsigned integer"			,"NOT NULL"	,"default '0'","key"),
			array("ie_published"		,"unsigned integer"			,"NOT NULL"	,"default '0'","key"),
			array("ie_version_major"	,"unsigned integer"			,"NOT NULL"	,"default '0'","key"),
			array("ie_version_minor"	,"unsigned integer"			,"NOT NULL"	,"default '0'","key"),
			array("ie_version_wip"		,"unsigned integer"			,"NOT NULL"	,"default '1'","key"),
			array("ie_parent"			,"unsigned integer"			,"NOT NULL"	,"default '0'","key"),
			array("ie_cached"			,"unsigned integer"			,"NOT NULL"	,"default '0'","key"),
			array("ie_counter"			,"integer"					,"NOT NULL"	,"default '-1'","key")
		);
		$primary ="ie_identifier";
		$tables[count($tables)] = array("information_entry", $fields, $primary);

		$fields = array(
			array("iev_identifier"		,"unsigned integer"			,"NOT NULL"	,"default '0'","key"),
			array("iev_client"			,"unsigned integer"			,"NOT NULL"	,"default '0'","key"),
			array("iev_entry"			,"unsigned integer"			,"NOT NULL"	,"default '0'","key"),
			array("iev_field"			,"varchar(255)"				,"NOT NULL"	,"default ''"),
			array("iev_value"			,"text"						,"NOT NULL"	,"default ''"),
			array("iev_list"			,"unsigned integer"			,"NOT NULL"	,"default '0'","key")
		);
		$primary ="iev_identifier";
		$tables[count($tables)] = array("information_entry_values", $fields, $primary);

		$fields = array(
			array("ievl_identifier"		,"unsigned integer"			,"NOT NULL"	,"default '0'","key"),
			array("ievl_client"			,"unsigned integer"			,"NOT NULL"	,"default '0'", "key"),
			array("ievl_entry"			,"unsigned integer"			,"NOT NULL"	,"default '0'", "key"),
			array("ievl_label"			,"varchar(255)"				,"NOT NULL"	,"default ''"),
			array("ievl_value"			,"text"						,"NOT NULL"	,"default ''"),
			array("ievl_list"			,"unsigned integer"			,"NOT NULL"	,"default '0'", "key"),
			array("ievl_rank"			,"unsigned integer"			,"NOT NULL"	,"default '0'", "key")
		);
		$primary ="ievl_identifier";
		$tables[count($tables)] = array("information_entry_links", $fields, $primary);


	
		$fields = array(
			array("if_identifier"		,"unsigned integer"			,"NOT NULL"	,"default '0'","key"),
			array("if_name"				,"varchar(255)"				,"NOT NULL"	,"default ''", "key"),
			array("if_client"			,"unsigned integer"			,"NOT NULL"	,"default '0'", "key"),
			array("if_list"				,"unsigned integer"			,"NOT NULL"	,"default '0'", "key"),
			array("if_label"			,"varchar(255)"				,"NOT NULL"	,"default ''"),
			array("if_rank"				,"unsigned integer"			,"NOT NULL"	,"default '0'", "key"),
			array("if_screen"			,"unsigned small integer"	,"NOT NULL"	,"default '0'", "key"),
//			array("if_search_form"		,"unsigned small integer"	,"NOT NULL"	,"default '0'"),
			array("if_duplicate"		,"varchar(20)"				,"NOT NULL"	,"default ''"),
			array("if_filterable"		,"unsigned small integer"	,"NOT NULL"	,"default '0'"),
			array("if_sumlabel"			,"unsigned small integer"	,"NOT NULL"	,"default '0'"),
			array("if_conlabel"			,"unsigned small integer"	,"NOT NULL"	,"default '0'"),
			array("if_link"				,"unsigned small integer"	,"NOT NULL"	,"default '0'", "key"),
			array("if_type"				,"varchar(255)"				,"NOT NULL"	,"default ''"),
			array("if_map"				,"varchar(255)"				,"NOT NULL"	,"default ''"), // map to a specific metadata field
			array("if_special"			,"unsigned small integer"	,"NOT NULL"	,"default '0'", "key")
		);
		$primary ="if_identifier";
		$tables[count($tables)] = array("information_fields", $fields, $primary);

		$fields = array(
			array("ifp_client"		,"unsigned integer"			,"NOT NULL"	,"default '0'","key"),
			array("ifp_list"		,"unsigned integer"			,"NOT NULL"	,"default '0'","key"),
			array("ifp_field"		,"unsigned integer"			,"NOT NULL"	,"default '0'","key"),
			array("ifp_group"		,"unsigned integer"			,"NOT NULL"	,"default '0'","key")
		);
		$primary ="";
		$tables[count($tables)] = array("information_field_protection", $fields, $primary);

	
		$fields = array(
			array("io_identifier"		,"unsigned integer"			,"NOT NULL"	,"default '0'","key"),
			array("io_client"			,"unsigned integer"			,"NOT NULL"	,"default '0'", "key"),
			array("io_field"			,"varchar(255)"				,"NOT NULL"	,"default ''", "key"),
			array("io_value"			,"varchar(255)"				,"NOT NULL"	,"default ''"),
			array("io_list"				,"unsigned integer"			,"NOT NULL"	,"default '0'", "key"),
			array("io_rank"				,"unsigned small integer"	,"NOT NULL"	,"default '0'", "key")
		);
		$primary ="io_identifier";
		$tables[count($tables)] = array("information_options", $fields, $primary);


		$fields = array(
			array("ier_identifier"		,"unsigned integer"			,"NOT NULL"	,"default '0'","key"),
			array("ier_client"			,"unsigned integer"			,"NOT NULL"	,"default '0'", "key"),
			array("ier_source_id"		,"unsigned integer"			,"NOT NULL"	,"default '0'", "key"),
			array("ier_source_cat"		,"unsigned integer"			,"NOT NULL"	,"default '0'", "key"),
			array("ier_dest_id"			,"unsigned integer"			,"NOT NULL"	,"default '0'", "key"),
			array("ier_dest_cat"		,"unsigned integer"			,"NOT NULL"	,"default '0'", "key"),
			array("ier_rank"			,"unsigned integer"			,"NOT NULL"	,"default '0'", "key")
		);
		$primary ="ier_identifier";
		$tables[count($tables)] = array("information_entry_relationship", $fields, $primary);


		$fields = array(
			array("iua_identifier"		,"unsigned integer"			,"NOT NULL"	,"default '0'","key"),
			array("iua_client"			,"unsigned integer"			,"NOT NULL"	,"default '0'", "key"),
			array("iua_user"			,"unsigned integer"			,"NOT NULL"	,"default '0'", "key"),
			array("iua_entry"			,"unsigned integer"			,"NOT NULL"	,"default '0'", "key"),
			array("iua_list"			,"unsigned integer"			,"NOT NULL"	,"default '0'", "key")
		);
		$primary ="iua_identifier";
		$tables[count($tables)] = array("information_update_access", $fields, $primary);


		$fields = array(
			array("ifeature_identifier"			,"unsigned integer"			,"NOT NULL"	,"default '0'","key"),
			array("ifeature_client"				,"unsigned integer"			,"NOT NULL"	,"default '0'", "key"),
			array("ifeature_status"				,"unsigned small integer"	,"NOT NULL"	,"default '0'", "key"),
			array("ifeature_list_type"			,"unsigned small integer"	,"NOT NULL"	,"default '0'", "key"), // 0 = manual, 1 = automatic
			array("ifeature_list"				,"unsigned integer"			,"NOT NULL"	,"default '0'", "key"), // belongs to directory
			array("ifeature_display_format"		,"unsigned integer"			,"NOT NULL"	,"default '0'", "key"), // 0 = summary, 1 = summary
			array("ifeature_display_rotation"	,"unsigned integer"			,"NOT NULL"	,"default '0'", "key"), // 0 = per visit, 1 = per page
			array("ifeature_label"				,"varchar(255)"				,"NOT NULL"	,"default '0'", "key"), // 
			array("ifeature_auto_counter"		,"unsigned integer"			,"NOT NULL"	,"default '1'", "key"), // number of entries to display
			array("ifeature_date_created"		,"datetime"					,"NOT NULL"	,"default ''", ""),
			array("ifeature_date_start"			,"datetime"					,"NOT NULL"	,"default ''", ""),
			array("ifeature_date_finish"		,"datetime"					,"NOT NULL"	,"default ''", ""),
			array("ifeature_all_locations"		,"unsigned integer"			,"NOT NULL"	,"default '0'",""), // all menu loactions
			array("ifeature_set_inheritance"	,"unsigned integer"			,"NOT NULL"	,"default '0'",""), // child location inherit
			array("ifeature_as_rss"				,"unsigned small integer"	,"NOT NULL"	,"default '0'", "key")
		);
		$primary ="ifeature_identifier";
		$tables[count($tables)] = array("information_features", $fields, $primary);

		$fields = array(
			array("ifl_identifier"				,"unsigned integer"			,"NOT NULL"	,"default '0'","key"),
			array("ifl_client"					,"unsigned integer"			,"NOT NULL"	,"default '0'", "key"),
			array("ifl_owner"					,"unsigned integer"			,"NOT NULL"	,"default '0'", "key"),
			array("ifl_entry"					,"unsigned integer"			,"NOT NULL"	,"default '0'", "key"),
			array("ifl_cat"						,"unsigned integer"			,"NOT NULL"	,"default '0'", "key"),
			array("ifl_rank"					,"unsigned integer"			,"NOT NULL"	,"default '0'", "key")
		);
		$primary ="";
		$tables[count($tables)] = array("information_feature_list", $fields, $primary);

		$fields = array(
			array("fieldname"		,"varchar(255)"			,"NOT NULL"	,"default ''"),
			array("counter"			,"unsigned integer"		,"NOT NULL"	,"default '0'"),
			array("useridentifier"	,"unsigned integer"		,"NOT NULL"	,"default '0'"),
			array("session"			,"varchar(32)"			,"NOT NULL"	,"default ''")
		);
		$primary ="";
		$tables[count($tables)] = array("tmp_rowdata", $fields, $primary);
		/*************************************************************************************************************************
		* Search tables (basic and advanced
	*************************************************************************************************************************/ 
		$fields = array(
			array("ibs_identifier"		,"unsigned integer"		,"NOT NULL"	,"default '0'","key"),
			array("ibs_client"			,"unsigned integer"		,"NOT NULL"	,"default '0'","key"),
			array("ibs_list"			,"unsigned integer"		,"NOT NULL"	,"default '0'","key"),
			array("ibs_label"			,"varchar(255)"			,"NOT NULL"	,"default ''"),
			array("ibs_date_created"	,"datetime"				,"NOT NULL"	,"default ''"),
			array("ibs_all_locations"	,"unsigned integer"		,"NOT NULL"	,"default '0'","key"),
			array("ibs_set_inheritance"	,"unsigned integer"		,"NOT NULL"	,"default '0'","key")
		);
		$primary ="";
		$tables[count($tables)] = array("information_search", $fields, $primary);
		$fields = array(
			array("ias_identifier"		,"unsigned integer"		,"NOT NULL"	,"default '0'","key"),
			array("ias_client"			,"unsigned integer"		,"NOT NULL"	,"default '0'","key"),
			array("ias_list"			,"unsigned integer"		,"NOT NULL"	,"default '0'","key"),
			array("ias_label"			,"varchar(255)"			,"NOT NULL"	,"default ''"),
			array("ias_date_created"	,"datetime"				,"NOT NULL"	,"default ''"),
			array("ias_all_locations"	,"unsigned integer"		,"NOT NULL"	,"default '0'","key"),
			array("ias_set_inheritance"	,"unsigned integer"		,"NOT NULL"	,"default '0'","key")
		);
		$primary ="";
		$tables[count($tables)] = array("information_advanced_search", $fields, $primary);
		
		$fields = array(
			array("iffr_owner"			,"unsigned integer"			,"NOT NULL"	,"default '0'","key"),
			array("iffr_client"			,"unsigned integer"			,"NOT NULL"	,"default '0'","key"),
			array("iffr_list"			,"unsigned integer"			,"NOT NULL"	,"default '0'","key"),
			array("iffr_rank"			,"unsigned integer"			,"NOT NULL"	,"default '0'","key"),
			array("iffr_label_display"	,"unsigned small integer"	,"NOT NULL"	,"default '0'","key"),
			array("iffr_label_override"	,"varchar(255)"				,"NOT NULL"	,"default ''"),
			array("iffr_field"			,"varchar(255)"				,"NOT NULL"	,"default ''")
		);
		$primary ="";
		$tables[count($tables)] = array("information_feature_field_rank", $fields, $primary);
		
		return $tables;
	}
	/**
	* call the initialisation function only when this module is created
	*/
	function create_client_details($parameters){
	}
		

}
?>